<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jsp/jstl/core"	
	template="/resources/scaffold/pageTemplate.xhtml">

	<f:metadata>
		<f:viewParam name="id" value="#{dayBookBean.id}"/>
		<f:event type="preRenderView" listener="#{dayBookBean.retrieve}"/>
	</f:metadata>

	<ui:param name="pageTitle" value="Create Day Book"/>

	<ui:define name="header">
		Day Book
	</ui:define>

	<ui:define name="subheader">
		<c:choose>
			<c:when test="#{!empty dayBookBean.id}">
				Edit existing Day Book
			</c:when>
			<c:otherwise>
				Create a new Day Book
			</c:otherwise>
		</c:choose>
	</ui:define>

	<ui:define name="footer"/>

	<ui:define name="main">
		<h:form id="create">
			<h:messages globalOnly="true" styleClass="error"/>

			<h:panelGrid columnClasses="label,component,required" columns="3">
				<h:outputLabel for="dayBookBeanDayBookAmount" value="Amount:"/>
				<h:panelGroup>
					<h:inputText id="dayBookBeanDayBookAmount" value="#{dayBookBean.dayBook.amount}"/>
					<h:message for="dayBookBeanDayBookAmount" styleClass="error"/>
				</h:panelGroup>
				<h:outputText/>
				<h:outputLabel for="dayBookBeanDayBookCreatedOn" value="Created On:"/>
				<h:panelGroup>
					<h:inputText id="dayBookBeanDayBookCreatedOn" maxLength="10" value="#{dayBookBean.dayBook.createdOn}">
						<f:convertDateTime type="date"/>
					</h:inputText>
					<h:message for="dayBookBeanDayBookCreatedOn" styleClass="error"/>
				</h:panelGroup>
				<h:outputText/>
				<h:outputLabel for="dayBookBeanDayBookModifiedOn" value="Modified On:"/>
				<h:panelGroup>
					<h:inputText id="dayBookBeanDayBookModifiedOn" maxLength="10" value="#{dayBookBean.dayBook.modifiedOn}">
						<f:convertDateTime type="date"/>
					</h:inputText>
					<h:message for="dayBookBeanDayBookModifiedOn" styleClass="error"/>
				</h:panelGroup>
				<h:outputText/>
				<h:outputLabel for="dayBookBeanDayBookPurpose" value="Purpose:"/>
				<h:panelGroup>
					<h:inputText id="dayBookBeanDayBookPurpose" value="#{dayBookBean.dayBook.purpose}"/>
					<h:message for="dayBookBeanDayBookPurpose" styleClass="error"/>
				</h:panelGroup>
				<h:outputText/>
				<h:outputLabel for="dayBookBeanDayBookTableId" value="Table Id:"/>
				<h:panelGroup>
					<h:inputText id="dayBookBeanDayBookTableId" required="true" value="#{dayBookBean.dayBook.tableId}"/>
					<h:message for="dayBookBeanDayBookTableId" styleClass="error"/>
				</h:panelGroup>
				<h:outputText value="*"/>
				<h:outputLabel for="dayBookBeanDayBookType" value="Type:"/>
				<h:panelGroup>
					<h:inputText id="dayBookBeanDayBookType" value="#{dayBookBean.dayBook.type}"/>
					<h:message for="dayBookBeanDayBookType" styleClass="error"/>
				</h:panelGroup>
				<h:outputText/>
				<h:outputLabel for="dayBookBeanDayBookCreatedBy" value="Created By:"/>
				<h:panelGroup>
					<h:inputText id="dayBookBeanDayBookCreatedBy" value="#{dayBookBean.dayBook.createdBy}"/>
					<h:message for="dayBookBeanDayBookCreatedBy" styleClass="error"/>
				</h:panelGroup>
				<h:outputText/>
				<h:outputLabel for="dayBookBeanDayBookModifiedBy" value="Modified By:"/>
				<h:panelGroup>
					<h:inputText id="dayBookBeanDayBookModifiedBy" value="#{dayBookBean.dayBook.modifiedBy}"/>
					<h:message for="dayBookBeanDayBookModifiedBy" styleClass="error"/>
				</h:panelGroup>
				<h:outputText/>
				<h:outputLabel for="dayBookBeanDayBookDirection" value="Direction:"/>
				<h:panelGroup>
					<h:selectBooleanCheckbox id="dayBookBeanDayBookDirection" value="#{dayBookBean.dayBook.direction}"/>
					<h:message for="dayBookBeanDayBookDirection" styleClass="error"/>
				</h:panelGroup>
				<h:outputText/>
				<h:outputLabel for="dayBookBeanDayBookIsDeleted" value="Is Deleted:"/>
				<h:panelGroup>
					<h:selectBooleanCheckbox id="dayBookBeanDayBookIsDeleted" value="#{dayBookBean.dayBook.isDeleted}"/>
					<h:message for="dayBookBeanDayBookIsDeleted" styleClass="error"/>
				</h:panelGroup>
				<h:outputText/>
				<h:outputLabel for="dayBookBeanDayBookIsPublic" value="Is Public:"/>
				<h:panelGroup>
					<h:selectBooleanCheckbox id="dayBookBeanDayBookIsPublic" value="#{dayBookBean.dayBook.isPublic}"/>
					<h:message for="dayBookBeanDayBookIsPublic" styleClass="error"/>
				</h:panelGroup>
				<h:outputText/>
			</h:panelGrid>

			<div class="buttons">
				<h:commandLink value="Save" action="#{dayBookBean.update}" styleClass="btn btn-primary"/>
				<c:choose>
					<c:when test="#{!empty dayBookBean.id}">
						<h:link value="Cancel" outcome="view" styleClass="btn btn-primary">
							<f:param name="id" value="#{dayBookBean.id}"/>
						</h:link>
						<h:commandLink value="Delete" action="#{dayBookBean.delete}" styleClass="btn btn-primary"/>
					</c:when>
					<c:otherwise>
						<h:link value="Cancel" outcome="search" styleClass="btn btn-primary"/>
					</c:otherwise>
				</c:choose>
			</div>
		</h:form>
	</ui:define>

</ui:composition>